﻿Imports System.Net.Mail

Partial Class ContactPage
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try

            ' create the email message 
            Dim _MailBody As String

            _MailBody = txtMailBody.Text.Trim()

            Dim message As New MailMessage()
            message.Body = _MailBody
            message.Subject = String.Format("New Contact Request")
            message.To.Add(ConfigurationManager.AppSettings("ToAdMail"))

            Dim smtpClient As New SmtpClient()
            smtpClient.UseDefaultCredentials = True
            smtpClient.Send(message)
        Catch ex As Exception
            ClientScript.RegisterHiddenField("error", ex.Message)
        End Try
    End Sub
End Class
